﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Guest.Master" AutoEventWireup="True"
    CodeBehind="Write.aspx.cs" Inherits="ScrumLite.WebUx.ProjectsViews.Write" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
    function save()
    {
        var name = document.getElementById("name");
        var repositoryPath = document.getElementById("repositoryPath");
        var projectSpecificMetricsPath = document.getElementById("projectSpecificMetricsPath");
        var group = document.getElementById("group");
        var startsOn = document.getElementById("startsOn");
        var endsOn = document.getElementById("endsOn");                        
        
        if (name.value == "")
        {
            alert("must insert a name");
            return;
        }
        if (repositoryPath.value == "")
        {
            alert("must insert a repository Url");
            return;
        }
        if (projectSpecificMetricsPath.value == "")
        {
            alert("must insert a Process Specific Metrics Url");
            return;
        }
        if (group.value == "")
        {
            alert("must insert a group");
            return;
        }
        if (startsOn.value == "")
        {
            alert("must insert a startsOn date");
            return;
        }
        if (endsOn.value == "")
        {
            alert("must insert a endsOn date");
            return;
        }                                        

        document.forms[0].submit();
    }
    </script>
    <h1>
    <%=ViewData.ProjectName%></h1>
    <hr />
    
    <form action="<%=Url.Action( new { Controller="Projects", Action = "Save" })%>"
    method="post">
    <br /> 
    <div class="actions">
        <a href="javascript:void(0);" tabindex="6" onclick="javascript:save();">Save</a>&nbsp;&nbsp;&nbsp;
        <%=Html.ActionLink("Cancel", new { Controller = "Projects", Action = "List" })%>
    </div>
    <div>
        <input name ="id" id ="id" type="hidden" value ="<%=ViewData.Project.Id%>" />
        <p>
            Name<br />
            <input name="name" id="name" tabindex="1" value="<%=ViewData.Project.Name%>"  />
        </p>
        <p>
            Repository Url<br />
            <input name="repositoryPath" id="repositoryPath" tabindex="2" value="<%=ViewData.Project.RepositoryUri %>" size="40" />
        </p>
        <p>
            Process Specific Metrics Url<br />
            <input name="projectSpecificMetricsPath" id="projectSpecificMetricsPath" tabindex="3" value="<%=ViewData.Project.ProjectSpecificMetricsUri %>" size="40" />
        </p>        
        <p>
            Group<br />
            <input name="group" id="group" tabindex="4" value="<%=ViewData.Project.Group%>" />
        </p>
        <p>
            Starts On<br />
            <input name="startsOn" id="startsOn" tabindex="5" value="<%=ViewData.Project.StartsOn.ToString("yyyy-MM-dd")%>" />
        </p>
        <p>
            Ends On<br />
            <input name="endsOn" id="endsOn" tabindex="6" value="<%=ViewData.Project.EndsOn.Value.ToString("yyyy-MM-dd")%>" />
        </p>
        
    </div>
        <div class="actions">
            <a href="javascript:void(0);" tabindex="6" onclick="javascript:save();">Save</a>&nbsp;&nbsp;&nbsp;
            <%=Html.ActionLink("Cancel", new { Controller = "Projects", Action = "List" })%>
        </div>
    </form>
</asp:Content>
